/*
 * Main.cpp
 *
 * Created on: 25-03-2014
 *     Author: A.W. Janisse
 */

#include <iostream>
#include "TestKlok.h"
#include "VerbruiksMeting.h"
#include "TestSensor.h"

#include <windows.h> // Sleep

using namespace std;

int main()
{
    cout << "This program is designed to be executed against a test framework." << endl;
    cout << "Choose 'test' as a build target and build/run it again." << endl;

    Display *display = new Display();
    TestOpslag *opslag = new TestOpslag();

    VerbruiksMeting *verbruiksMeting  = new VerbruiksMeting(display, opslag);

    TestKlok *klok = new TestKlok();
    TestSensor *sensor = new TestSensor();
    klok->attachObserver(verbruiksMeting);
    sensor->attachObserver(verbruiksMeting);

    klok->tick();
    Sleep(1000);
    klok->tick();
    Sleep(1000);
    for(int i = 0; i < 1000; i++) {
        sensor->tick();
    }

    klok->tick();
    Sleep(1000);
    klok->tick();
    Sleep(1000);

    for(int i = 0; i < 5000; i++) {
        sensor->tick();
    }

    delete klok;
    delete sensor;
    delete verbruiksMeting;
    delete display;
    delete opslag;

    return 0;
}
